<?php
namespace app\shouyin\model;

use think\Model;
use app\product\model\Product as ProductModel;
use think\Db;
class Reim extends Model
{
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;

    public function setUsetimeAttr($value,$data)
    {
        return strtotime($data['usetime']);
    }
    public function getUsetimeAttr($value)
    {
        return date('Y-m-d',$value);
    }
    public function getCreatetimeAttr($value)
    {
        return date('Y-m-d',$value);
    }

    public function getAdminNameAttr($value)
    {
        $adminName = Db::name('system_user')->where('id',$value)->value('nick');
        return $adminName;
    }
    public function getFinanceNameAttr($value)
    {
        $financeName = Db::name('system_user')->where('id',$value)->value('nick');
        return $financeName;
    }
    public function getAccountNameAttr($value)
    {
        $accountName = Db::name('account')->where('id',$value)->value('name');
        return $accountName;
    }
    public function getShopNameAttr($value)
    {
        $shopName = Db::name('shop')->where('id',$value)->value('name');
        return $shopName;
    }

    public function getClassNameAttr($value)
    {
        $className = Db::name('classofreim')->where('id',$value)->value('name');
        return $className;
    }
}
